<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>我的订阅</title>
    <link rel="stylesheet" href="../css/reset.css">
    <link rel="stylesheet" href="../css/grid-list.css">
</head>
<body>
<div id="title">
    我的订阅
</div>
<div id="content" class="card001">
    <script type="text/html" id="listTemp">
        {{each}}
        <div class="list-item" data-url="{{$imports.goto}}?id={{$value[$imports.idType]}}&title={{$value.titleName}}">
            <div class="list-item-wrap">
                {{if $value.order==='0'}}
                <div class="status status-1">已订阅</div>
                {{else if $value.order==='10'}}
                <div class="status status-0">已过期</div>
                {{else}}

                {{/if}}
                <div class="statistics">
                    <div class="viewNum">
                        <img src="../images/module/card/img-title-like-view-status-card001/view.png" alt="">
                        <p>{{$value.clickNums}}</p>
                    </div>
                    <div class="likeNum">
                        <img src="../images/module/card/img-title-like-view-status-card001/like.png" alt="">
                        <p>{{$value.collectNumber}}</p>
                    </div>
                </div>
                <div class="thumb">
                    <img src="{{$value.poster|getCover}}" alt="" onerror="this.src='../images/default.png'">
                </div>
                <div class="mask"></div>
                <div class="name">{{$value.titleName}}</div>
            </div>
        </div>
        {{/each}}
    </script>
</div>
<div id="pageControl">
    <div id="prev"><img src="../images/grid-list/prev.png" alt=""></div>
    翻页
    <div id="next"><img src="../images/grid-list/next.png" alt=""></div>
</div>
<div id="pageInfo">
    <span class="curPage">1/</span><span class="totalPage">1</span>
</div>
<script src="../js/S.js"></script>
<script src="../js/common.js"></script>
<script src="../js/tvProcess.js"></script>
<script src="../js/template-web.js"></script>
<script src="../js/list.js"></script>
<script src="../js/dialog.js"></script>
<script>
    /**
     * DEMO测试数据正式环境请删除
     * 创建于西南版权交易中心项目
     */
    tools.test('http://10.0.1.122:8080/CMSInterfaceManage/myServletControls.do?action=getMenusByFileJson&fname=configs/copyright/configs_web.json',
        '11126d834032346d1bc87380363bf4d8084616fd4a13b58dac9f71cd41910810014de7b10c12c0142576824fe4af74e3d7d3027cfc2c07e08b96f5410644b398bb4051fa4f6cd975420bc31500795a12e8a0f8d3c4fbbdeae644460fec9ffd42dda5c0542b838e638e0add412cda91b4c3ef6deae1392ca5e59edaea328e46350b43027bffa362095d9d67b50e3e2a1e71e118a757349dd5592b909fd6442ba56041b872e9d0644161bbdba28f4ab7227ddd534352a7fd2a88a7bf77afa84ce2bce86b6f358c6797b836208c15792e856a')

    keyopt.options.focusElm = 'listItem1';


    var title = tools.getUrlParam('title')||'心愿单';
    var action = tools.getUrlParam('action') || '';
    var id = tools.getUrlParam('id')||'01221019181060016';
    var pageIndex = tools.getSave('page') ? tools.getSave('page') : 0;

    var firstView = true;
    $('#title').text(title);
    if (!action) {
        switch (title) {
            case '我的订阅':
                action = 'getOrderList_v1_0';
                template.defaults.imports.goto = 'media-view.html';
                template.defaults.imports.idType = 'productId';
                break;
            case '心愿单':
                action = 'getLogcollectiontbList';
                template.defaults.imports.goto = 'work-details.html';
                template.defaults.imports.idType = 'contentId';
                break;
            case '浏览历史':
                action = 'getLogBrowseList';
                template.defaults.imports.goto = 'work-details.html';
                template.defaults.imports.idType = 'contentId';
                break;
            default:
                break;
        }
    }

    var cardList = new List({
        action: action,
        col: 4,
        params: {
            menuId: '',
            stairColumnId: '',
            pageIndex: pageIndex,
            pageSize: 8,
            choice: 0
        },
        callback: function (data) {
            $('#pageInfo').html('<span class="curPage">' + cardList.def.currentPage + '/</span><span class="totalPage">' + cardList.def.totalPage + '</span>')

            if (firstView) {
                $('#listItem1').addClass('active');
                firstView = false
            }
            if(data.datas.length===0){
                cardList.setParams({stairColumnId: id,pageIndex:0}).getData().addPositionControl(0, 0, 4, 4, 4, 2).addKeyPressControl();
                $('#listItem1').addClass('active');
            }
            tools.recoveryFocus();
            cardList.setListOnSubmit(function (code, id) {
                tools.saveFocus({page: cardList.def.currentPage - 1});
            })
        }
    });
    cardList.setParams({stairColumnId: id}).getData().addPositionControl(0, 0, 4, 4, 4, 2).addKeyPressControl();

</script>
</body>
</html>